package practice;

public class YangHui {
    public static void main(String[] args) {
        YangHui(5);
    }
    public static void YangHui(int n){
        if(n == 1)
            System.out.println(1);
        if(n ==2 ){
            System.out.println(1);
            System.out.println(1+" "+1);
        }
        int[][] arr = new int[n][n];
        arr[0][0] = 1;
        arr[1][0] = 1;
        arr[1][1] = 1;
        System.out.println(arr[0][0]);
        System.out.println(arr[1][0]+" "+arr[1][1]);
        for(int i=2;i<n;i++){
            arr[i][0] = 1;
            arr[i][i] = 1;
            System.out.print(arr[i][0]+" ");
            for (int j=1;j<i;j++){
                arr[i][j] = arr[i-1][j-1] + arr[i-1][j];
                System.out.print(arr[i][j]+" ");
            }
            System.out.println(arr[i][i]);
        }
    }
}
